﻿<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE HTML>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title>MERCHANT CENTER</title>
		<%@ include file="/share/include.jsp" %>
   		 <meta name="viewport" content="width=device-width, initial-scale=1">
		 <script type="application/x-javascript"> 
			addEventListener("load", function() { 
				setTimeout(hideURLbar, 0); 
			}, false); 
			function hideURLbar(){ 
				window.scrollTo(0,1); 
			} 
		</script>
		<script type="text/javascript">
			$(function(){
				//表单提交前 验证 表单
		        $("#updateForm").Validform({
					btnSubmit : "#btn_sub",
					tiptype : 3,
					beforeCheck:function(curform){
						 
					 },
					 beforeSubmit:function(data){
						 
					 }
				});
				
				$('#picPath').click();
			});
			
		</script>
		<style type="text/css">
			
		</style>
	</head>
	<body>
		<!-- container -->
		<!-- header -->
		<div class="header">
			<%@ include file="/control/jsp/layout/header.jsp" %>
			<!-- /bottom-header -->
		</div>
		<!-- header -->
		<!--- top-nav -->
			<%@ include file="/control/jsp/layout/sellerMenu.jsp" %>
		<!--- top-nav -->
		<!-- script-for-nav -->
			
		<!-- /script-for-nav -->
		<!-- Product-Details-page -->
		<div class="details-page">
			<div class="content details-page">
				<div class="product-details">
					<div class="container">
						<div class="details-left" style="width: 100%;margin-top: 20px;">
						    <h4 style="color:red;"><img style="padding: 10px;" src="${root}/images/bx.gif" />
								<c:if test="${operateStatus == 'edit' }">Editing cases:</c:if>
								<c:if test="${operateStatus == 'add' }">Add case:</c:if>
						    </h4>
							<form id="updateForm" action="${root }/control/shop/casesController/${operateStatus }.do" method="post" enctype="multipart/form-data">
								<input type="hidden" name="caseShopId" value="${cases.caseShopId }" />
								<input type="hidden" name="caseId" value="${cases.caseId }" />
								<table style="width: 100%" cellpadding="0" cellspacing="0">
									<tbody>
									<tr style="height: 40px;">
										<td class="tit_left" style="width: 200px; "><strong>Case name:</strong></td>
										<td class="tit_cont"><input type="text" name="caseTitle" value="${fn:escapeXml(cases.caseTitle) }" style="width: 60%;" maxlength="50" dataType="*1-50" /></td>
									</tr>
									<tr style="height: 40px;">
										<td class="tit_left"><strong>Apartment layout:</strong></td>
										<td class="tit_cont"><input type="text" name="caseHouseType" value="${fn:escapeXml(cases.caseHouseType) }" style="width: 60%;" maxlength="50" dataType="*1-50" /></td>
									</tr>
									<tr style="height: 40px;">
										<td class="tit_left"><strong>Area:</strong></td>
										<td class="tit_cont"><input type="text" name="caseArea" value="<fmt:formatNumber type="number" pattern="###.#">${cases.caseArea }</fmt:formatNumber>" style="width: 60%;" maxlength="9" dataType="/^\d{1,6}(\.\d{1,2})?$/"/>(㎡)</td>
									</tr>
									<tr style="height: 40px;">
										<td class="tit_left"><strong>Cost:</strong></td>
										<td class="tit_cont"><input type="text" name="casePrice" value="<fmt:formatNumber type="number" pattern="###.#">${cases.casePrice }</fmt:formatNumber>" style="width: 60%;" maxlength="10" dataType="/^\d{1,7}(\.\d{1,2})?$/"/>($)</td>
									</tr>
									<tr>
										<td class="tit_left" ><strong>Description:</strong></td>
										<td class="tit_cont">
											<textarea name="caseContent" rows="2" cols="8" id="caseContent" style="height:120px;width:60%;"  maxlength="2000" dataType="*1-2000">${fn:escapeXml(cases.caseContent) }</textarea>
										</td>
									</tr>
									<tr>
										<td class="tit_left"><strong>Picture:</strong></td>
										<td class="tit_cont">
										    <div id="caseImages">
										    	<c:if test="${not empty cases and not empty cases.picList }">
							  						<c:forEach items="${cases.picList }" var="pic">
							  							<div class="parentImageDiv" style="float:left;margin: 5px;">
												    		<span>
												    			<img style="width: 100px; height:100px;" src="${imageService }${pic.picPath}" />
												    			<input type="hidden" name="picPath" value="${pic.picPath}" >
												    		</span>
												    		<span>
												    			<img style='height:100px;' src="${root}/images/close.png" onclick="removeImage(this);"/>
												    		</span>
												    	</div>
							  						</c:forEach>
							  					</c:if>
										    </div>
										    <c:if test="${not empty cases and not empty cases.picList and picCount == 10 }">
										    <div id="picPathDiv" style="display: none;">
										    </c:if>
										    <c:if test="${empty cases or empty cases.picList }">
										    <div id="picPathDiv">
										    </c:if>
									    		<c:if test="${not empty cases and not empty cases.picList }">
									    			<input type="hidden" id="picValue" name="" value="1" dataType="*" />
									    		</c:if>
									    		<c:if test="${empty cases or empty cases.picList }">
									    			<input type="hidden" id="picValue" name="" value="" dataType="*" />
									    		</c:if>
									    		<input class="l_input" style="width: 140px;height: 150px;background: url('${root}/images/new_pic_add.gif') 50% 45% no-repeat;" type="button" id="picPath" value="" onclick="uploadCaseImage('picPath','picValue','caseImages','${imageService}','${root}/images/close.png');" />
									    	</div>
										</td>
									</tr>
									<tr><td style="height: 60px;"></td></tr>
								</tbody></table>
								<div class="clear"></div>
								<table style="margin: 20px;width: 100%;text-align: center;">
									<tbody><tr>
										<td > 
											<input type="submit" name="BtnSubmit" value="Submit" id="BtnSubmit" class="p-btn"> &nbsp;&nbsp;
											<c:if test="${operateStatus == 'edit' }">
												<input type="reset" class="p-btn" onclick ="javascript:history.go(-1);" value="Cancel">
											</c:if>
											<c:if test="${operateStatus == 'add' }">
												<input type="reset" class="p-btn" value="Reset">
											</c:if>
										</td>
									</tr>
								</tbody></table>
							</form>
						</div>
						<div class="clearfix"> </div>
					</div>
			    </div>
		    </div>
		</div>
		<!-- /Product-Details-page -->
		<!-- footer -->
		<%@ include file="/control/jsp/layout/footer.jsp" %>
</body>
</html>

